

import java.io.*;
import java.util.*;

public class Polycarp {

	public static void main(String[] args){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			char[] line = br.readLine().toCharArray();
			ArrayList<Character> ans = new ArrayList<Character>(line.length);
			for(int i=0;i<line.length;i++){
				if(!ans.isEmpty() && line[i] == ans.get(ans.size()-1)){
					ans.remove(ans.size()-1);
				}else ans.add(line[i]);
			}
			System.out.println(ans);
			String answer = String(ans.toArray());
			System.out.println(answer);
		}catch(IOException e){
			System.out.println(e);
		}catch(NumberFormatException e){
			System.out.println(e);
		}
	}

	private static String String(Object[] array) {
		// TODO Auto-generated method stub
		return null;
	}
}
